﻿using System;

namespace Ndex.Core
{
    public class EmailAddress
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }

        public EmailAddress()
        {
            Name = string.Empty;
            Email = string.Empty;
        }

        public override string ToString()
        {
            Name = Name ?? string.Empty;
            
            if (Name == string.Empty)
                return Email;

            return string.Format("{0} <{1}>", StringExt.Trim(Name), StringExt.Trim(Email));
        }
    }
}